package com.summer.framework.common.entity.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.http.HttpStatus;

import java.io.Serializable;
import java.util.Date;

/**
 * @auther: 杨杰
 * @date: 2018/12/26 12:04
 * @description: 返回格式定义
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class BaseResponse implements Serializable {

    private Integer status = HttpStatus.OK.value();

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date time = new Date();

    private String message;


    public BaseResponse(Integer status, String message) {
        this.status = status;
        this.message = message;
    }

    public BaseResponse(Integer status) {
        this.status = status;
        this.message = "";
    }

    public BaseResponse(String message) {
        this.message = message;
    }
}
